package com.wzy.vx.service.impl;

import com.wzy.vx.dataobject.ProductCategory;
import com.wzy.vx.repository.ProductCategoryRepository;
import com.wzy.vx.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ProjectName: vx
 * @Package: com.wzy.vx.service.impl
 * @ClassName: CategoryServiceImpl
 * @Author: Administrator
 * @Description: ${description}
 * @Date: 2019/3/11 17:23
 * @Version: 1.0
 */
@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private ProductCategoryRepository productCategoryRepository;

    @Override
    public ProductCategory findOne(Integer category) {
        return productCategoryRepository.findById(category).orElse(null);
    }

    @Override
    public List<ProductCategory> findAll() {
        return productCategoryRepository.findAll();
    }

    @Override
    public List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList) {
        return productCategoryRepository.findByCategoryTypeIn(categoryTypeList);
    }

    @Override
    public ProductCategory save(ProductCategory productCategory) {
        return productCategoryRepository.save(productCategory);
    }
}
